#pragma once
namespace lyz
{
	template<class K>
	struct BSTreeNode
	{
		typedef BSTreeNode<K> Node;
		Node* _left;
		Node* _right;
		K _key;
	};

	template<class K>
	class BinarySearchTree
	{
		typedef BSTreeNode<K> Node;
		bool find(const K& key)
		{
			Node* cur = _root;
			while (cur)
			{
				if (cur->_key < key)
				{
					cur = cur->_right;
				}
				else if (cur->_key > key)
				{
					cur = cur->_left;
				}
				else
				{
					return true;
				}
			}

			return false;
		}
	private:
		Node* _root = nullptr;
	};
}
